
const username = document.querySelector('#inputuserName')
const userpwd = document.querySelector('#inputpwd')
const userZc = document.querySelector('#iduserzc')
const msguser = document.querySelector('#msguser')
utils.on( userZc, 'click', function () {
    const name = username.value
          pwd = userpwd.value
          utils.fetch('./api/user/user-user.php',{ name, pwd}).then( resp => {
            console.log(resp)
            msguser.innerHTML = resp.list.msg
            if(resp.code === 200) {
                msguser.classList.add('text-success')
                setTimeout(() => {
                    $('#user-user').modal('hide') 
                }, 1000);
            }else{
                msguser.classList.add('text-danger')
            }
            setTimeout(() => {
                msguser.innerHTML = '' 
                msguser.className = 'text-center'
            }, 1000)
        })
       
})

$('#user-user').on('hidden.bs.modal', function (e) {
    username.value = userpwd.value = ''
  })

